import { defineStore } from 'pinia'
import { ref } from 'vue'

export type AuthType = 'accountLogin' | 'smsLogin' | 'smsRegister' | 'resetPassword' | 'changeMobile' | 'changePassword' | 'changeUsername'| null;

export const useModalStore = defineStore('modal',
    () => {
        const auth = ref<AuthType>(null)

        const setAuth = (value: AuthType) => {
            auth.value = value
        }
        return {
            auth,
            setAuth
        }
    },
    {
        persist: {
            enabled: true,
            strategies: [
                {
                    key: 'modal',
                    storage: localStorage,
                }
            ]
        }
    }
)